package com.skytech.tax.customsdatawarehouse.singlewindow.taxhandle.resource;

import com.skytech.tax.customsdatawarehouse.singlewindow.taxhandle.domain.service.TaxBillGoodsService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author Lianhong
 * @since 2022/4/19
 */
@RestController
@RequestMapping("/single-window/tax-bill/goods")
public class TaxBillGoodsController {

    @Resource
    private TaxBillGoodsService taxBillGoodsService;

    /**
     * 保存税费单货物信息
     */
    @PostMapping
    public void saveTaxBillGoods(@RequestBody String taxBillGoods) {
        taxBillGoodsService.saveTaxBillGoods(taxBillGoods);
    }

    /**
     * 查询税费单货物信息
     *
     * @return 税费单货物信息
     */
    @GetMapping("{taxHeadSeqNo}")
    public String taxBillGoods(@PathVariable String taxHeadSeqNo) {
     return taxBillGoodsService.getTaxBillGoods(taxHeadSeqNo);
    }

    /**
     * 海关数据库中是否已存在税费单货物信息
     */
    @GetMapping("{taxHeadSeqNo}/exists")
    public boolean taxBillGoodsExists(@PathVariable String taxHeadSeqNo) {
        return taxBillGoodsService.taxBillGoodsExists(taxHeadSeqNo);
    }
}
